// pages/dengmi/denglong/denglong.js
Page({
  data: {
    dengzhu: "https://fcdn.qiushilaile.com/adx/adx-95051610442953546.png",
    bg: "https://fcdn.qiushilaile.com/adx/adx-79981610443015805.png",
    dl1: "https://fcdn.qiushilaile.com/adx/adx-18351610443629023.png",
    dl2: "https://fcdn.qiushilaile.com/adx/adx-22471610443617714.png",
    dl3: "https://fcdn.qiushilaile.com/adx/adx-76181610443609761.png",
    dl4: "https://fcdn.qiushilaile.com/adx/adx-74171610443623206.png",
    dl5: "https://fcdn.qiushilaile.com/adx/adx-72071610443643351.png",
    dl6: "https://fcdn.qiushilaile.com/adx/adx-71821610443637823.png",
  },
  onLoad: function (options) {
    let that = this
    that.ani()
    setInterval(() => {
      that.ani()
    }, 18000)
  },
  ani() {
    let that = this
    setTimeout(() => {
      that.animation();
    }, 50)
    setTimeout(() => {
      that.animation2();
    }, 3000)
    setTimeout(() => {
      that.animation3();
    }, 6000)
    setTimeout(() => {
      that.animation4();
    }, 9000)
    setTimeout(() => {
      that.animation5();
    }, 12000)
    setTimeout(() => {
      that.animation6();
    }, 15000)
  },
  animation() { // 动画3s
    var animation = wx.createAnimation({
      duration: 500,
    })
    animation.translateX(0).rotate(10).step()
    animation.translateX(0).rotate(-10).step()
    animation.translateX(0).rotate(0).step()
    animation.translateX(0).rotate(10).step()
    animation.translateX(0).rotate(-10).step()
    animation.translateX(0).rotate(0).step()
    this.setData({
      animation: animation.export(),
    })
  },
  animation2() {
    var animation2 = wx.createAnimation({
      duration: 500,
    })
    animation2.translateX(0).rotate(10).step()
    animation2.translateX(0).rotate(-10).step()
    animation2.translateX(0).rotate(0).step()
    animation2.translateX(0).rotate(10).step()
    animation2.translateX(0).rotate(-10).step()
    animation2.translateX(0).rotate(0).step()
    this.setData({
      animation2: animation2.export(),
    })
  },
  animation3() {
    var animation3 = wx.createAnimation({
      duration: 500,
    })
    animation3.translateX(0).rotate(10).step()
    animation3.translateX(0).rotate(-10).step()
    animation3.translateX(0).rotate(0).step()
    animation3.translateX(0).rotate(10).step()
    animation3.translateX(0).rotate(-10).step()
    animation3.translateX(0).rotate(0).step()
    this.setData({
      animation3: animation3.export(),
    })
  },
  animation4() {
    var animation4 = wx.createAnimation({
      duration: 500,
    })
    animation4.translateX(0).rotate(10).step()
    animation4.translateX(0).rotate(-10).step()
    animation4.translateX(0).rotate(0).step()
    animation4.translateX(0).rotate(10).step()
    animation4.translateX(0).rotate(-10).step()
    animation4.translateX(0).rotate(0).step()
    this.setData({
      animation4: animation4.export(),
    })
  },
  animation5() {
    var animation5 = wx.createAnimation({
      duration: 500,
    })
    animation5.translateX(0).rotate(10).step()
    animation5.translateX(0).rotate(-10).step()
    animation5.translateX(0).rotate(0).step()
    animation5.translateX(0).rotate(10).step()
    animation5.translateX(0).rotate(-10).step()
    animation5.translateX(0).rotate(0).step()
    this.setData({
      animation5: animation5.export(),
    })
  },
  animation6() {
    var animation6 = wx.createAnimation({
      duration: 500,
    })
    animation6.translateX(0).rotate(10).step()
    animation6.translateX(0).rotate(-10).step()
    animation6.translateX(0).rotate(0).step()
    animation6.translateX(0).rotate(10).step()
    animation6.translateX(0).rotate(-10).step()
    animation6.translateX(0).rotate(0).step()
    this.setData({
      animation6: animation6.export(),
    })
  },
  startPaly: function (res) {
    let index = res.currentTarget.dataset.type;
    tt.navigateTo({
      url: '/pages/dengmi/dengmi/dengmi?index=' + index // 指定页面的url
    });
    console.log(index)
  },
  back: function () {
    tt.navigateBack();
  },
})